<?php

class Core_Models_DbTable_ClubsTours extends Zend_Db_Table_Abstract {

    protected $_name = "clubs_tours";
    protected $_rowClass = "Core_Models_ClubTour";
    static private $_instance;

    public static function getInstance() {
        if (!(self::$_instance instanceof Core_Models_DbTable_ClubsTours)) {
            self::$_instance = new Core_Models_DbTable_ClubsTours();
        }
        return self::$_instance;
    }

    public function getClubs($params) {
        $select = $this->select()
                ->setIntegrityCheck(FALSE)
                ->from('clubs_tours', array('id_tour', 'id_club'))
                ->join('clubs', 'clubs.id = clubs_tours.id_club', array('club_name' => 'name'))
                ->join('tournaments', 'tournaments.id = clubs_tours.id_tour', array('tour_name' => 'name'))
                ->where('clubs_tours.id_tour = ?', $params['id_tour']);
        $clubs = $this->fetchAll($select);

        return $clubs;
    }

}